"""
微信相关的数据模型
"""

from pydantic import BaseModel
from typing import Optional, Dict, Any
from datetime import datetime


class WeChatConfig(BaseModel):
    """微信配置模型"""
    app_id: str
    app_secret: str
    token: Optional[str] = None
    encoding_aes_key: Optional[str] = None


class MiniProgramInfo(BaseModel):
    """小程序信息模型"""
    id: Optional[int] = None
    name: str
    app_id: str
    app_secret: str
    description: Optional[str] = None
    status: str = "active"
    created_at: Optional[datetime] = None
    updated_at: Optional[datetime] = None


class OfficialAccountInfo(BaseModel):
    """公众号信息模型"""
    id: Optional[int] = None
    name: str
    app_id: str
    app_secret: str
    token: Optional[str] = None
    encoding_aes_key: Optional[str] = None
    description: Optional[str] = None
    status: str = "active"
    created_at: Optional[datetime] = None
    updated_at: Optional[datetime] = None


class AccessTokenInfo(BaseModel):
    """Access Token信息模型"""
    access_token: str
    expires_in: int
    expires_at: datetime


class MaterialInfo(BaseModel):
    """素材信息模型"""
    media_id: str
    name: str
    update_time: int
    url: Optional[str] = None


class UserInfo(BaseModel):
    """用户信息模型"""
    openid: str
    nickname: Optional[str] = None
    sex: Optional[int] = None
    city: Optional[str] = None
    country: Optional[str] = None
    province: Optional[str] = None
    language: Optional[str] = None
    headimgurl: Optional[str] = None
    subscribe_time: Optional[int] = None
